package com.aaa.marketing.controller.api;/**
 * Date:2023/3/2
 * Author：臣哥哥
 * Description:
 */


import com.aaa.entity.CustomerIssues;
import com.aaa.marketing.dao.CustomerIssuesDao;
import com.aaa.marketing.service.CustomerIssuesService;
import com.aaa.security.annotation.HasPermission;
import com.aaa.security.annotation.MyLog;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author     ：Xiaochen
 * @date       ：Created in 2023/3/2 12:21
 * @description：
 * @modified By：
 * @version:
 */
@Api(value = "marketing/api/customerIssues", tags = {"客户问答"})
@RestController
@RequestMapping("marketing/api/customerIssues")
public class ApiCustomerIssuesController {
    @Autowired
    private CustomerIssuesService customerIssuesService;


    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
            @ApiImplicitParam(paramType = "body", dataType = "CustomerIssues", name = "customerIssues", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "")
    @HasPermission(value = "customerIssues:search")
    @MyLog(title = "查询所有客服问答")
    @RequestMapping("select")
    @ResponseBody
    public Result list(@RequestParam(defaultValue = "1") Integer currentPage, @RequestParam(defaultValue = "5") Integer pageSize, @RequestBody CustomerIssues customerIssues){
        return customerIssuesService.selectAll(currentPage,pageSize,customerIssues);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "CustomerIssues", name = "customerIssues", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @HasPermission(value = "customerIssues:insert")
    @MyLog(title = "添加客服问答")
    @PostMapping("insert")
    public Result insert(@RequestBody CustomerIssues customerIssues){
        return customerIssuesService.insert(customerIssues);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "CustomerIssues", name = "customerIssues", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @HasPermission(value = "customerIssues:update")
    @MyLog(title = "修改客服问答")
    @PostMapping("update")
    public Result update(@RequestBody CustomerIssues customerIssues){
        return customerIssuesService.update(customerIssues);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "id", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "GET")
    @HasPermission(value = "customerIssues:delete")
    @MyLog(title = "删除客服问答")
    @GetMapping("delete")
    public Result delete(Integer id){
        return customerIssuesService.delete(id);
    }


    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "CustomerIssues", name = "customerIssues", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "POST")
    @HasPermission(value = "customerIssues:search")
    @MyLog(title = "查询所有客服问答的所属模块")
    @PostMapping("findAll")
    public Result findAll(@RequestBody CustomerIssues customerIssues){
        return customerIssuesService.selectBySubmodule(customerIssues);
    }

}